﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using MulagoDb.model;

namespace MulagoDb.database
{
   public class HospitalizationDB
    {
       //1
       public static void inserthospitalization_major(HospitalizationMajor hm)
       {

           try
           {
               PatientRegistration.persist.Save(hm);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //2
       public static void inserthospitalization_abnormaltcd(HospitalizationAbnormaltcd hab)
       {

           try
           {
               PatientRegistration.persist.Save(hab);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //3
       public static void inserthospitalization_acutepain(HospitalizationAcutepain hacu)
       {

           try
           {
               PatientRegistration.persist.Save(hacu);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //4
       public static void inserthospitalization_avascularnecrosis(HospitalizationAvascularnecrosis hoava)
       {

           try
           {
               PatientRegistration.persist.Save(hoava);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //5
       public static void inserthospitalization_cholecystitis(HospitalizationCholecystitis hoch)
       {

           try
           {
               PatientRegistration.persist.Save(hoch);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //6
       public static void inserthospitalization_dactylitis(HospitalizationDactylitis hosda)
       {

           try
           {
               PatientRegistration.persist.Save(hosda);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //7
       public static void inserthospitalization_diagnosisgeneral(HospitalizationDiagnosisgeneral hdgeneral)
       {

           try
           {
               PatientRegistration.persist.Save(hdgeneral);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //8
       public static void inserthospitalization_investigations(HospitalizationInvestigations hi)
       {
           try
           {
               PatientRegistration.persist.Save(hi);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //9
       public static void inserthospitalization_legulcer(HospitalizationLegulcer hosleg)
       {

           try
           {
               PatientRegistration.persist.Save(hosleg);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //10
       public static void inserthospitalization_menengitis(HospitalizationMenengitis hmen)
       {

           try
           {
               PatientRegistration.persist.Save(hmen);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //11
       public static void inserthospitalization_osteomyelitis(HospitalizationOsteomyelitis hos)
       {

           try
           {
               PatientRegistration.persist.Save(hos);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //12
       public static void inserthospitalization_physicalexamination(HospitalizationPhysicalexamination hpe)
       {
           try
           {
               PatientRegistration.persist.Save(hpe);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //13
       public static void inserthospitalization_sepsis(HospitalizationSepsis hs)
       {
           try
           {
               PatientRegistration.persist.Save(hs);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //14
       public static void inserthospitalization_severanaemia(HospitalizationSeveranaemia hosan)
       {

           try
           {
               PatientRegistration.persist.Save(hosan);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //15
       public static void inserthospitalization_stroke(HospitalizationStroke hostr)
       {
           try
           {
               PatientRegistration.persist.Save(hostr);
           }
           catch (Exception ex)
           {
               //
           }
       }
       //16
       public static void inserthospitalization_treatment(int pid, string observation, string analgesia,
           string antibiotics, string antimalarials, string rbctransfusion, string surgery, string delivery, string other)
       {
           MySqlConnection connection = new MySqlConnection(PatientRegistration.myConString);
           connection.Open();
           MySqlCommand command = connection.CreateCommand();
           string query = "INSERT INTO hospitalization_treatment VALUES(" + pid + ",'" +
               observation + "','" + analgesia + "','" + antibiotics + "','" + antimalarials + "','" +
                rbctransfusion + "','" + surgery +"','"+delivery+ "','" + other + "')";
           command.CommandText = query;
           MySqlDataReader reader = command.ExecuteReader();
           connection.Close();
       }
       


    }
}
